Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  properties: {
    selected: {
      type: Boolean,
      value: false,
      observer(newVal, oldVal, path){
        this.setData({selectedData: newVal});
      }
    },
    disabled: {
      type: Boolean,
      value: false,
    },
    index: {
      type: Number,
      value: -1
    },
  },
  data: {
    selectedData:false
  },
  lifetimes:{
    attached(){
      this.setData({selectedData: this.properties.selected});
    }
  },
  methods: {
    onCBChange(e) {
      if(this.properties.disabled)return;
      this.setData({selectedData: !this.data.selectedData});
      this.triggerEvent('change',{selected: e.detail,index:this.properties.index});
    }
  }
})
